<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script src="../static/elementui/index.css"></script>
    <script src="../static/elementui/index.js"></script>
    <script src="../static/js/vue.js"></script>
    <script src="../static/js/axios.js"></script>
    <script src="../static/js/util.js"></script>
    <!-- 引入ElementUI样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">

    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <!-- 引入ElementUI组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>

</head>

<body>
<div id="app">
    <el-form ref="form" :model="pojo" label-width="80px">
        <el-form-item label="名称">
            <el-input v-model="pojo.name"></el-input>
        </el-form-item>
        <el-form-item label="密码">
            <el-input v-model="pojo.password" type="password"></el-input>
        </el-form-item>
        <el-form-item label="性别">
            <el-radio-group v-model="pojo.sex">
                <el-radio label="男"></el-radio>
                <el-radio label="女"></el-radio>
            </el-radio-group>
        </el-form-item>
        <el-form-item label="年龄">
            <el-input type="textarea" v-model="pojo.age"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="add()">立即创建</el-button>
            <el-button>取消</el-button>
        </el-form-item>
    </el-form>
    
</div>
    <script>
    new Vue({
        el: "#app",
        data: {
            pojo:{}
        },
        created() {
            
        },
        methods: {
            add(){
              axios.post("http://localhost:8080/emp/add",this.pojo).then(
                  res=>{
                      alert("添加成功")
                      location.href = "show.html";
                  }
              )
            }
        }
    })
</script>
</body>

</html>